package com.txtdhis.producer.controller;


import com.txtdhis.common.domain.User;
import com.txtdhis.producer.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
public class UserController {


    @Autowired
    private UserService userservice;

    @PostMapping("/queryUserForList")
    public List<User> queryUserForList(@RequestBody User user){
        List<User> userList = userservice.queryUserForList(user);
        return userList;
    }


    @GetMapping("/getUser/{id}")
    public User getUser(@PathVariable("id") String id){

        User user = userservice.getUser(Integer.valueOf(id));
        return  user;
    }


    @PostMapping("/insert")
    public int insert(@RequestBody User user){

        int flag = userservice.insert(user);

     return flag;

    }
    @GetMapping("/setCache/{val}")
    public String setCache(@PathVariable("val") String val){
        return userservice.setCache(val);
    }

}
